﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Mighty.Lib.Document
{
    public class DefaultOpenHandler : IOpenProvider
    {

        public DefaultOpenHandler() { }

        #region IOpenProvider Members

        public List<string> Open(Dictionary<string, object> loadParams)
        {
            // change this to take a stream instead to make it more testable..
        	//StreamReader reader = new StreamReader((string)loadParams["OpenFilePath"]);
        	StreamReader reader = new StreamReader((Stream)loadParams["Stream"],Encoding.Default);
        	List<string> list = new List<string>();
            string line = "";
            while ((line = reader.ReadLine()) != null)
            {
                list.Add(line+"\r\n");
            }
            return list;
        }

        #endregion
    }
}
